package org.lansir.af.ui;

import org.lansir.af.R;
import org.lansir.af.reminder.AlarmService;
import org.lansir.af.util.Prefs;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

public class HomeActivity extends BaseActivity {
    
	private boolean bTipsExit;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.activity_home);
        getActivityHelper().setupActionBar(null, 0);
        startReminderService();
       
    }
    
    public boolean startReminderService() {
		ComponentName cpn = startService(new Intent(HomeActivity.this, AlarmService.class));
		return (cpn != null);
	}
    
    

	@Override
	protected void onStart() {
		super.onStart();
		bTipsExit = false;
	}


	@Override
	public void onBackPressed() {
		if(bTipsExit)
			super.onBackPressed();
		else{
			Toast.makeText(this, R.string.toast_tips_exit, Toast.LENGTH_SHORT).show();
			bTipsExit = true;
		}
	}
    
    
}